<?php

namespace app\adminapi\validate;

use app\common\validate\BaseValidate;

class SysNoticeValidate extends BaseValidate
{
    protected $rule = [
        'pageNo' => 'regex:/^([1-9]\d*)$/',
        'pageSize' => ['regex'=>'/^(-1|[1-9]\d*)$/'],
        'timeArr' => 'array',
        'noticeId' => 'require|number',
        'noticeTitle' => 'require',
        'noticeContent' => 'require',
        'status' => 'number',
        'noticeType' => 'number'
    ];

    protected $message = [
        'pageNo.number' => '分页页码只能是数字',
        'pageSize.number' => '分页页大小只能是数字',
        'timeArr.array' => '时间数组格式错误',
        'id.require' => '参数不完整',
        'noticeId.number' => '系统通知ID类型错误',
        'noticeTitle.require' => '请输入公告标题',
        'noticeContent.require' => '请输入公告内容',
        'status.require' => '状态参数值错误',
        'noticeType' => '公告类型参数值错误'
    ];

    protected $scene = [
        'list' => ['pageNo', 'pageSize', 'timeArr', 'status', 'noticeType'],
        'insert' => ['noticeTitle', 'noticeContent', 'status', 'noticeType'],
        'delete' => ['noticeId'],
        'query' => ['noticeId'],
        'update' => ['noticeId', 'noticeTitle', 'noticeContent', 'status', 'noticeType']
    ];
}